package com.tiger.poker.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;

import javax.websocket.Session;
import java.util.List;


/**
 * @author Rick on 2/12/19 3:03 PM
 */
@Data
public class Player {

    private String name;

    private Integer score;

    private List<Poker> pokers;

    @JsonIgnore
    private Session session;

    private int status;

    private int operationStatus;

    public Player(Session session) {
        this.session = session;
    }

    @Override
    public boolean equals(Object o) {
        if (o instanceof Player) {
            return this.session == ((Player) o).getSession();
        }
        return false;
    }

    @Override
    public int hashCode() {
        if (session == null) {
            return 0;
        }
        return session.hashCode();
    }

}
